<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
    <div id="box"></div>
	<hr>
	<button id="btn_create">添加</button>
	<button id="btn_delete">删除</button>
 </body>
 <script>
   var i  = 1;
    var btn = document.getElementById("btn_create");
	var btn_1 = document.getElementById("btn_delete"); 
	btn.onclick = function(){
	  var btn1 = document.createElement("button");
	  var div = document.getElementById("box");
	  btn1.style.marginLeft="5px";
	  btn1.innerHTML = i++;
	  div.appendChild(btn1);
	}
	btn_1.onclick = function(){
	  var div = document.getElementById("box");
      var div_last = div.lastChild;
	  var div_first = div.firstChild;
	  div.removeChild(div_first);
	}
 </script>
</html>
